package com.ayf.payment.game.api.service.platform;

import com.ayf.payment.game.api.dto.criteria.OrderInfoCriteria;
import com.ayf.payment.game.api.dto.platform.MerchantCashOutBatchDTO;
import com.ayf.payment.game.api.dto.platform.MerchantCashOutCountDTO;
import com.ayf.payment.game.api.dto.platform.MerchantCashOutDTO;
import com.ayf.payment.game.api.dto.platform.MerchantSettleDayDTO;
import com.ayf.payment.game.api.dto.platform.criteria.MerchantCashOutCriteria;
import com.ayf.payment.game.api.dto.platform.criteria.MerchantCashOutPageCriteria;
import com.ayf.payment.game.api.entity.platform.MerchantCashOut;
import com.ayf.payment.game.api.exception.ParameterException;
import com.ayf.payment.game.api.utils.CommonResult;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface MerchantCashOutService {

	/**
	 * 查询可结算列表 D+1
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantSettleDayDTO> selectMerchantSettleDay1(MerchantCashOutPageCriteria selectCriteria);

	/**
	 * 查询可结算列表 D+0
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantSettleDayDTO> selectMerchantSettleDay0(MerchantCashOutPageCriteria selectCriteria);

	/**
	 * 汇总可结算列表 D    settleCycle 0 D+0  1 D+1
	 *
	 * @param selectCriteria
	 * @return
	 */
	MerchantCashOutCountDTO countMerchantSettleDay(MerchantCashOutCriteria selectCriteria);

	/**
	 * 确认结算 D+1
	 *
	 * @param launchName
	 * @param operatorName
	 * @param merchantSettleDayDTO
	 * @throws Exception
	 */
	@Transactional(rollbackFor = Exception.class)
	CommonResult merchantSettleDay1(String launchName, String operatorName, MerchantSettleDayDTO merchantSettleDayDTO, String traceId) throws ParameterException;

	/**
	 * 用户手动提现申请
	 *
	 * @param launchName
	 * @param merchantSettleDayDTO
	 * @param minWithdrawalAmount
	 * @throws Exception
	 */
	@Transactional(rollbackFor = Exception.class)
	CommonResult merchantSettleManual(String launchName, MerchantSettleDayDTO merchantSettleDayDTO, String traceId) throws ParameterException;

	/**
	 * 查询提现列表
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantCashOutDTO> selectMerchantCashOutAll(MerchantCashOutPageCriteria selectCriteria);

	/**
	 * 汇总 付款列表金额   2 待付款   3 已付款
	 *
	 * @param selectCriteria
	 * @return
	 */
	MerchantCashOutCountDTO countMerchantCashOutAll(MerchantCashOutCriteria selectCriteria);

	/**
	 * 查询提现列表
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantCashOutDTO> selectMerchantCashOutAllNoPage(MerchantCashOutCriteria selectCriteria);

	/**
	 * 查询提现列表
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantCashOutBatchDTO> selectBatchOrderAll(MerchantCashOutPageCriteria selectCriteria);

	/**
	 * 根据批次号获取提现列表
	 *
	 * @param selectCriteria
	 * @return
	 */
	List<MerchantCashOutDTO> getCashOutByBatchList(MerchantCashOutCriteria selectCriteria);


	/**
	 * 根据商户ID获取结算数据
	 *
	 * @param merchantId
	 * @return
	 */
	MerchantSettleDayDTO getMerchantSettleData(Integer merchantId);

	@Transactional
	void updatetradeStatus(String operatorName, String tradeNumber, int tradeStatus, int cashOutType, String traceId) throws ParameterException;

	/**
	 * 商户提现付款
	 *
	 * @param operatorName
	 * @param tradeNumber
	 * @param tradePwd
	 */
	@Transactional
	CommonResult merchantSettlePayment(String operatorName, String tradeNumber, String traceId, String settleBatchOrderNo, Date batchTime, String payChannelCode, Integer cashOutType, String tradePwd);

	/**
	 * 拒绝付款
	 *
	 * @param operatorName
	 * @param tradeNumber
	 * @param tradeStatus
	 */
	@Transactional
	void updateRefuseMerchantPayment(String operatorName, String tradeNumber, String traceId);

	/**
	 * 拒绝提现审核
	 *
	 * @param operatorName
	 * @param tradeNumber
	 * @param tradeStatus
	 */
	@Transactional
	void updateRefuseMerchantVerify(String operatorName, String tradeNumber, String traceId) throws ParameterException;

	/**
	 * 代付款
	 *
	 * @param traceId
	 * @param requestBody
	 * @param sign
	 */
	boolean YHBpaymentOnbehalfOf(String traceId, String requestBody, String sign);

	/**
	 * 万象代付款
	 *
	 * @param traceId
	 * @param orderNo
	 */
	boolean WanXPaymentOnBehalfOf(String traceId, String status, String orderNo);

	/**
	 * 龙宝代付款
	 *
	 * @param traceId
	 * @param orderNo
	 * @param desc
	 */
	boolean LongBaoPaymentOnBehalfOf(String traceId, String status, String orderNo, String desc);

	/**
	 * 卓付通代付款
	 *
	 * @param traceId
	 * @param orderNo
	 * @param desc
	 */
	boolean ZhuoFuTongPaymentOnBehalfOf(String traceId, String status, String orderNo, String desc);

	/**
	 * 查询商户提现汇总信息
	 *
	 * @param cri
	 * @return
	 */
	Map<Integer, Map<String, Object>> selectSumWithdrawal(OrderInfoCriteria cri);

	void updateMerchantCashOut(MerchantCashOutDTO merchantCashOut);

	/**
	 * 根据订单ID 获取
	 *
	 * @param tradeNumber
	 * @return
	 */
	MerchantCashOut getMerchantCashOutByTradeNumber(String tradeNumber);

	/**
	 * 修改提现记录用户信息
	 *
	 * @param merchantSettleDayDTO
	 * @return
	 */
	boolean updateMerchantCashOutByTradeNumber(MerchantSettleDayDTO merchantSettleDayDTO);


	@Transactional(rollbackFor = Exception.class)
	CommonResult realTimeWithdrawalApply(String launchName, MerchantSettleDayDTO merchantSettleDayDTO, String traceId) throws ParameterException;

	boolean QiYiPaymentOnBehalfOf(String traceId, String status, String orderNo);

	boolean WanWPaymentOnBehalfOf(String traceId, Map<String, String> reqParamMap);

	MerchantCashOut getMerchantCashOutByChannelOrderNo(String channelOrderNo);

	/**
	 * 星游代付款
	 *
	 * @param traceId
	 * @param orderNo
	 */
	boolean XingYouPaymentOnBehalfOf(String traceId, String status, String orderNo);

	boolean YouKaPaymentOnBehalfOf(String traceId, String status, String orderNo, String channelSign, String amount);

	boolean HuanDongPaymentOnBehalfOf(String traceId, String status, String orderNo, Map<String, String> signMap, String channelSign);

	boolean qcjhPaymentOnBehalfOf(String traceId, Map<String, String> reqParamMap);

	boolean huYuPaymentOnBehalfOf(String traceId, Map<String, String> reqParamMap);

	void updateSettleAgentPayOrderStatus(MerchantCashOutDTO merchantCashOutDTO);

	boolean faKaPaymentOnBehalfOf(String traceId, Map<String, String> reqParamMap);

	boolean sky98PaymentOnBehalfOf(String traceId, Map<String, String> reqParamMap);

}
